package svc

import (
	"api/internal/config"
	"api/internal/middleware"
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
	"srv/shenzhouclient"
)

type ServiceContext struct {
	Config      config.Config
	AuthToken   rest.Middleware
	ShenzhouSrv shenzhouclient.Shenzhou
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:      c,
		AuthToken:   middleware.NewAuthTokenMiddleware().Handle,
		ShenzhouSrv: shenzhouclient.NewShenzhou(zrpc.MustNewClient(c.ShenzhouSrv)),
	}
}
